import {HTTP} from '../utils/http'

class CartModel extends HTTP{
  list(){
    return this.request({
      url:'cart/viewCart',
    })
  }

  save(goodsId,goodsSkuId,quantity){
    return this.request({
      url:'cart/save',
      data:{
        goodsId: goodsId,
        quantity: quantity || 1,
        goodsSkuId: goodsSkuId
      }
    })
  }

  delete(goodsId,cartId){
    return this.request({
      url:'cart/subtractCartCommodity',
      data: {
        goodsId: goodsId,
        quantity: 1,
        cartId: cartId
      }
    })
  }
}

export {CartModel}